// hyb_yl/jibing/jibing.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    fl_id:'',
    currentTab: 0
  },
  taocan1:function(e){
    var that = this
    //console.log(e.currentTarget.dataset.id);
    var fl_id = e.currentTarget.dataset.id
    that.setData({
      fl_id: fl_id,
      currentTab: 0
    })
    app.util.request({
      'url': "entry/wxapp/Kcfl",
      data: { fl_id: fl_id },
      success: function (res) {
        console.log(res)
        that.setData({
          dataarray: res.data.data

        })
        // WxParse.wxParse('article', 'html', res.data.data.z_content, that, 5);
      },
      fail: function (err) {
        console.log(err)
      },
    })
  },
  // 点击切换套餐选项卡
  taocan: function (e) {
    var that =this
    console.log(e.currentTarget.dataset.id);
    var fl_id = e.currentTarget.dataset.id 
    that.setData({
      fl_id: fl_id,
      currentTab: e.currentTarget.dataset.index+1
    })
    app.util.request({
      'url': "entry/wxapp/Kcfl",
      data: { fl_id: fl_id},
      'cachetime': '0',
      success: function (res) {
        console.log(res)
        that.setData({
          dataarray: res.data.data

        })
        // WxParse.wxParse('article', 'html', res.data.data.z_content, that, 5);
      },
      fail: function (err) {
        console.log(err)
      },
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) { 
    var bgc = wx.getStorageSync('color')
    var biaoti3 = options.biaoti3
    wx.setNavigationBarTitle({
      title: biaoti3
    })
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    this.getBase();
    var that=this;
    var openid = wx.getStorageSync('openid');
    that.setData({
      currentTab: options.index,
    })
    app.util.request({
      'url': "entry/wxapp/Schoolflarray",
      data: { },
      'cachetime': '0',
      success: function (res) {
        console.log(res)
        that.setData({
          taocan: res.data.data

        })
        // WxParse.wxParse('article', 'html', res.data.data.z_content, that, 5);
      },
      fail: function (err) {
        console.log(err)
      },
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
 
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  },
    //轮播图
  getBase: function (e) {
    var that = this;
    let id = that.data.fl_id
    console.log(id);
    app.util.request({
      'url': "entry/wxapp/Kcfl",
      data: {
        fl_id: id
      },
      success: function (res) {
        //console.log(res)
        that.setData({
          dataarray: res.data.data
        })
      },
      fail: function (err) {
        console.log(err)
      },
    })
  },
})